import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);
const router = new VueRouter({
  base: __dirname,
  // mode: 'hash',
  routes: [
    {
      path: "/",
      name: "main",
      redirect: "/home",
    },
    {
      path: "/pager",
      name: "pager",
      component: () => import('../views/pager.vue'),
      meta: {title: "pager", showTitle: false}
    },
    {
      path: "/pagerView",
      name: "pagerView",
      component: () => import('../views/pagerView.vue'),
      meta: {title: "pagerView", showTitle: true}
    },
    {
      path: "/test",
      name: "test",
      component: () => import('../views/test.vue'),
      meta: {title: "测试", showTitle: true}
    },
    {
      path: "/groupUser",
      name: "groupUser",
      component: () => import('../views/groupUser/groupUser.vue'),
      meta: {title: "桃李学校阳光分班程序", showTitle: true}
    },
    {
      path: "/groupUserNew",
      name: "groupUserNew",
      component: () => import('../views/groupUser/groupUserNew.vue'),
      meta: {title: "桃李学校阳光分班程序", showTitle: true}
    },
    {
      path: "/manageUser",
      name: "manageUser",
      component: () => import('../views/manageUser/manageUser.vue'),
      meta: {title: "桃李学校阳光分班管理", showTitle: true}
    },
    {
      path: "/playback",
      name: "playback",
      component: () => import('../views/playback/playback.vue'),
      meta: {title: "轨迹回放", showTitle: true}
    },
    {
      path: "/home",
      name: "home",
      component: () => import('../views/home.vue'),
      meta: {title: "首页", showTitle: true}
    },
    {
      path: "/transParams",
      name: "transParams",
      component: () => import('../views/transParams/index.vue'),
      meta: {title: "传参示例", showTitle: true},
    }, {
      path: "/jadp",
      name: "jadp",
      component: () => import('../views/jadp/index.vue'),
      meta: {title: "jadp页面", showTitle: true},
    },
    {
      path: "/clipboardTest",
      name: "clipboardTest",
      component: () => import('../views/clipboardTest/index.vue'),
      meta: {title: "clipboardTest", showTitle: true},
    },
    {
      path: "/ffmpegTest",
      name: "ffmpegTest",
      component: () => import('../views/ffmpegTest/index.vue'),
      meta: {title: "ffmpegTest", showTitle: true},
    }, {
      path: "/refreshTest",
      name: "refreshTest",
      component: () => import('../views/refreshTest/index.vue'),
      meta: {title: "refreshTest", showTitle: true},
    },
    {
      path: "/slideVerifyTest",
      name: "slideVerifyTest",
      component: () => import('../views/slideVerifyTest/index.vue'),
      meta: {title: "滑动校验组件", showTitle: true},
    },
    {
      path: "/transParams/query",
      name: "query",
      component: () => import('../views/transParams/query.vue'),
      meta: {title: "query参数页面", showTitle: true}
    },
    {
      path: "/transParams/params",
      name: "params",
      component: () => import('../views/transParams/params.vue'),
      meta: {title: "params参数页面", showTitle: true}
    },
    {
      path: "/aliCloud",
      name: "aliCloud",
      component: () => import('../views/aliCloud/index.vue'),
      meta: {title: "阿里云网盘", showTitle: false}
    },
    {
      path: "/relation",
      name: "relation",
      component: () => import('../views/relation/index.vue'),
      meta: {title: "逻辑关系图形化", showTitle: false}
    },
    {
      path: "/jsonMap",
      name: "jsonMap",
      component: () => import('../views/jsonMap/index.vue'),
      meta: {title: "JSON数据图形化", showTitle: false}
    },
    {
      path: "/element",
      name: "element",
      component: () => import('../views/element/index.vue'),
      meta: {title: "elementui测试", showTitle: false}
    },
    {
      path: "/element2",
      name: "element2",
      component: () => import('../views/element/element2.vue'),
      meta: {title: "elementui测试", showTitle: false}
    },
    {
      path: "/element1",
      name: "element1",
      component: () => import('../views/element/element1.vue'),
      meta: {title: "elementui测试", showTitle: false}
    },
    {
      path: "/maptest",
      name: "maptest",
      component: () => import('../views/element/maptest.vue'),
      meta: {title: "elementui测试", showTitle: false}
    },
    {
      path: "/maptest1",
      name: "maptest1",
      component: () => import('../views/element/maptest1.vue'),
      meta: {title: "elementui测试", showTitle: false}
    },
    {
      path: "/maptest2",
      name: "maptest2",
      component: () => import('../views/element/maptest2.vue'),
      meta: {title: "elementui测试", showTitle: false}
    },
    {
      path: "/maptest3",
      name: "maptest3",
      component: () => import('../views/element/maptest3.vue'),
      meta: {title: "elementui测试", showTitle: false}
    },
    {
      path: "/difyTest",
      name: "difyTest",
      component: () => import('../views/difyTest/index.vue'),
      meta: {title: "difyTest", showTitle: false}
    },
    {
      path: "/childrenDemo",
      name: "childrenDemo",
      component: () => import('../views/childrenDemo/index.vue'),
      meta: {title: "children示例", showTitle: true},
      children: [
        {
          path: "/childrenDemo/child1",
          name: "child1",
          component: () => import('../views/childrenDemo/child1.vue'),
          meta: {title: "child1页面", showTitle: true}
        },
        {
          path: "/childrenDemo/child2",
          name: "child2",
          component: () => import('../views/childrenDemo/child2.vue'),
          meta: {title: "child2页面", showTitle: true}
        },
      ]
    }
  ],
});
/**
 *  在进入路由之前每次都会执行此方法 全局钩子
 */
router.beforeEach((to, from, next) => {
  document.title = to.meta.title;
  next();
});
router.afterEach(function (to) {
});
export default router;
